﻿@Html.DevExpress().GridView(
            settings =>
            {
                settings.Name = "gvEditing";
                settings.KeyFieldName = "FId";
                settings.CallbackRouteValues = new { Controller = "AllowancePay", Action = "SpecialAdjustClsListPartial" };
                settings.Width =System.Web.UI.WebControls.Unit.Percentage(100);
                settings.Columns.Add(column =>
                {
                    column.Caption = "操作";

                    column.SetDataItemTemplateContent(c =>
                    {
                        //Html.DevExpress().HyperLink(s => { s.Name = "linkEdit" + c.VisibleIndex; s.Properties.Text = "修改"; s.ToolTip = "修改"; s.Properties.ImageUrl = Url.Content("~/Content/ControlImages/button_Edit.png"); s.Properties.ClientSideEvents.Click = "function(){TaxPayerManagerEdit('" + DataBinder.Eval(c.DataItem, "NSRDZDAH") + "')}"; s.Style.Add(HtmlTextWriterStyle.Cursor, "pointer"); }).GetHtml();
                        //ViewContext.Writer.Write("  ");
                        Html.DevExpress().HyperLink(s => { s.Name = "linkDel" + c.VisibleIndex; s.Properties.Text = "删除"; s.ToolTip = "删除"; s.Properties.ImageUrl = Url.Content("~/Content/ControlImages/button_delete.png"); s.Properties.ClientSideEvents.Click = "function(){codeDel('" + DataBinder.Eval(c.DataItem, "FId") + "')}"; s.Style.Add(HtmlTextWriterStyle.Cursor, "pointer"); }).GetHtml();
                    });
                    column.Settings.AllowDragDrop = DefaultBoolean.False;
                    column.Settings.AllowSort = DefaultBoolean.False;

                    column.Width = 40;
                });
               
                //settings.Columns.Add("FPayCertNo", "公司编码");
                settings.Columns.Add("FPayDateStr", "拨款日期");
                settings.Columns.Add("FAmount", "拨款金额");
                settings.Columns.Add("FPayCertNo", "拨款凭证号");
                settings.Columns.Add("FInsEmpName", "拨款人");
                settings.Columns.Add("FNote", "备注");
               // settings.Columns.Add("FInsDate", "录入日期");
             
                
                settings.SettingsBehavior.AllowSort = false;
                settings.SettingsBehavior.AllowDragDrop = false;
                settings.SettingsBehavior.AllowSelectByRowClick = false;
                settings.SettingsLoadingPanel.Text = "数据读取中...";
                settings.SettingsBehavior.AllowClientEventsOnLoad = false;
                settings.SettingsBehavior.AllowFocusedRow = true;
                settings.SettingsPager.PageSize = 10;
               
                settings.ClientSideEvents.BeginCallback = "function(s,e){OnBeginCallback(s,e)}";
                settings.CommandColumn.Visible = false;

                settings.PageIndexChanged = (sender, e) =>
                {
                    ASPxGridView grid = (ASPxGridView)sender;
                    grid.Selection.UnselectAll();
                };
                settings.DataBinding = (sender, e) =>
                {
                    ASPxGridView grid = (ASPxGridView)sender;
                    for (int i = 0; i < grid.AllColumns.Count; i++)
                    {
                        if (grid.AllColumns[i].CellStyle.HorizontalAlign == System.Web.UI.WebControls.HorizontalAlign.NotSet)
                        {
                            grid.AllColumns[i].CellStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
                        }
                        if (grid.AllColumns[i].HeaderStyle.HorizontalAlign == System.Web.UI.WebControls.HorizontalAlign.NotSet)
                        {
                            grid.AllColumns[i].HeaderStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
                        }
                    }
                };                                       
                
            }).Bind(Model).GetHtml()
